<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 在ie浏览器中会将换行符变成&#10，所以进行模板编译的时候需要特殊的处理
        let inBrowser = true
        // check whether current browser encodes a char inside attribute values
        let div
        function getShouldDecode(href) {
            div = div || document.createElement('div')
            div.innerHTML = href ? '<a href="\n"/>' : '<div a="\n"/>'
            return div.innerHTML.indexOf('&#10;') > 0
        }

        // #3663: IE encodes newlines inside attribute values while other browsers don't
        const shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false
        // #6828: chrome encodes content in a[href]
        const shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false
        console.log(shouldDecodeNewlines,shouldDecodeNewlinesForHref)
    </script>
</body>

</html>